!pr0
!lm12
!rm75
Epson MX-80 Text Screen Dump.................Ulf Schlichtmann
                                                 West Germany

Here is a short machine language program I wrote some time ago when I was working on a data-base program.  It permits you to make a hard copy of the Apple text screen.  It was written for an Epson MX-80 with Epson's Apple II Interface kit type 2, but with just one slight modification it should work with any other printer or interface as well.

I thought readers of AAL might have a use for this, especially after seeing a similar program in NIBBLE (Vol. 3 No. 3 pages 147-148) that was over three times longer to produce exactly the same result!  The authors of that program required 149 bytes, and even used self-modifying code.  My routine is only 40 bytes long.

There is one difference:  in the NIBBLE program KSWL,H is changed so that the routine will be invoked every time control-P is pressed; also the ampersand vector is set up to re-install the KSWL,H vector whenever needed.  I don't need these features, but even when they are added my program is still only about 78 bytes long (and WITHOUT any self-modifying code!).

Lines 1180-1200 direct all following output to the printer, and is equivalent to the Applesoft statements:

    PR#1 : PRINT

Next I store $8D (left over from MON.CROUT) as the number of columns for the printer, since any number greater than 40 will disable output to the screen.  If you have a different printer interface card, you may need to use a different location than $678+SLOT.  It should be stated somewhere in the printer interface manual.  This is the slight modification I mentioned earlier.

Then I use the Applesoft VTAB routine to calculate the base address for each line.  The entry point I chose requires the X-register to be loaded with the number of the desired line (starting with zero for the top-most line).  The base address will then be stored in BASL,H.  [ Note that using AS.VTAB means that this program will only work if Applesoft is switched on.  If you call this when the other memory bank is on, no telling what might happen! ]

Next I let Y run from 0 to 39 to pick up all the characters in that particular line via indirect addressing.  Each character is immediately fed to the printer.  Upon completing a line, I call MON.CROUT to cause the printer to print the line.  When I have sent all 24 lines, I then redirect output to the CRT and rehook DOS (lines 1340-1350).
!np
Of course, there are a lot of possibilities for adding features to my basic screen dumper.  The next version below does not rely on the Applesoft version of VTAB, so it can be called even when the Applesoft image is switched out.  I also draw a border around the screen image:  a line of dashes above and below, and vertical lines up down both sides.

Instead of using $8D as a line length to turn off the screen output, I masked out the flag bit in $7F8+SLOT.  This works in the Grappler and Grappler Plus interfaces, whereas the former method did not.  (It is equivalent to printing control-I and letter-N.)

Further, I now restore the value of BASL,H at line 1490.  Otherwise the value in CV ($25) and the address in BASL,H do not agree after printing the screen.

The last enhancement is at lines 1340-1370.  Here I now convert characters from  flashing and inverse modes to normal mode, or to blanks in some cases.  You might want to arrange for a different mapping here, according to your own taste.

Even with all these enhancements, the program is still only 86 bytes long.  The first version could be loaded anywhere without reassembly, because there are no internal references.  The second version does have an internal JSR, so it would have to be reassembled to run at other locations, or modified to be made run-anywhere.
